package com.box.ai.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.box.ai.pojo.entity.CourseReservation;
import com.box.ai.mapper.CourseReservationMapper;
import com.box.ai.service.CourseReservationService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * (CourseReservation)表服务实现类
 *
 * @author makejava
 * @since 2025-04-06 13:18:13
 */
@Service("courseReservationService")
public class CourseReservationServiceImpl implements CourseReservationService {
    @Resource
    private CourseReservationMapper courseReservationDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public CourseReservation queryById(Integer id) {
        return this.courseReservationDao.queryById(id);
    }


    /**
     * 新增数据
     *
     * @param courseReservation 实例对象
     * @return 实例对象
     */
    @Override
    public CourseReservation insert(CourseReservation courseReservation) {
        this.courseReservationDao.insert(courseReservation);
        return courseReservation;
    }

    /**
     * 修改数据
     *
     * @param courseReservation 实例对象
     * @return 实例对象
     */
    @Override
    public CourseReservation update(CourseReservation courseReservation) {
        this.courseReservationDao.update(courseReservation);
        return this.queryById(courseReservation.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.courseReservationDao.deleteById(id) > 0;
    }
}
